<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
        xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
        layout:decorate="layout">
    <head>
        <title>Messages : Create</title>
    </head>
    <body>
        <h1 layout:fragment="header">Messages : Create</h1>
        <div layout:fragment="content" class="container">
            <form id="messageForm" th:action="@{/(form)}" th:object="${message}"
                    action="#" method="post">
                <div th:if="${#fields.hasErrors('*')}" class="alert alert-error">
                    <p th:each="error : ${#fields.errors('*')}" th:text="${error}">
                        Validation error</p>
                </div>
                <div class="pull-right">
                    <a th:href="@{/}" href="messages.html"> Messages </a>
                </div>
                <input type="hidden" th:field="*{id}"
                        th:class="${#fields.hasErrors('id')} ? 'field-error'" /> <label
                                for="summary">Summary</label> <input type="text"
                                        th:field="*{summary}"
                                        th:class="${#fields.hasErrors('summary')} ? 'field-error'" /> <label
                                                for="text">Message</label>
                                        <textarea th:field="*{text}"
                                                th:class="${#fields.hasErrors('text')} ? 'field-error'"></textarea>
                                        <div class="form-actions">
                                            <input type="submit" value="Save" />
                                        </div>
                                    </form>
                                </div>
                            </body>
                        </html>
